/**
 * 
 */
package org.swing.utility.jai.bean;
import java.beans.BeanDescriptor;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
/**
 * @author Quynh Nhu
 *
 */
public class CameraBeanInfo extends SimpleBeanInfo {
	  private static final Class CAMERA_BEAN_CLASS = Camera.class;

	  private static final String[] PROPERTY_NAMES = new String[] {
	    "id", "make", "model"
	  };

	  private static final String[] PROPERTY_DISPLAY_NAMES = new String[] {
	    "Camera id", "Make", "Model"
	  };

	  private BeanDescriptor beanDescriptor;

	  private PropertyDescriptor[] propertyDescriptors;

	  public CameraBeanInfo() {
	    beanDescriptor = new BeanDescriptor(CAMERA_BEAN_CLASS);
	    propertyDescriptors = new PropertyDescriptor[PROPERTY_NAMES.length];
	    for (int i = 0; i < PROPERTY_NAMES.length; i++) {
	      String propertyName = PROPERTY_NAMES[i];
	      String propertyDisplayName = PROPERTY_DISPLAY_NAMES[i];
	      try {
	        PropertyDescriptor propertyDescriptor = new PropertyDescriptor(
	          propertyName, CAMERA_BEAN_CLASS);
	        propertyDescriptor.setDisplayName(propertyDisplayName);
	        propertyDescriptors[i] = propertyDescriptor;
	      } catch (IntrospectionException e) {
	        throw new RuntimeException("Unable to find property " + propertyName
	          + " on bean " + CAMERA_BEAN_CLASS.getName());
	      }
	    }
	  }

	  public BeanDescriptor getBeanDescriptor() {
	    return beanDescriptor;
	  }

	  public PropertyDescriptor[] getPropertyDescriptors() {
	    return propertyDescriptors;
	  }

	}
